#include "MouseEvent.h"

#include "Platform/PlatformInterface.h"

// TDelegate<bool,const SMouseButtonEvent &> SMouseButtonEvent::MouseCapturer=TDelegate<bool,const SMouseButtonEvent &>();


EMouseEventType SMouseButtonEvent::GetType() const
{
    return Type;
}

EMouseButton SMouseButtonEvent::GetButton() const
{
    assert((Type==EMouseEventType::ButtonUp || Type==EMouseEventType::ButtonDown) && "GetButton only valid for ButtonUp/ButtonDown event");
    return Button;
}

bool SMouseButtonEvent::IsDoubleClick() const
{
    assert(Type==EMouseEventType::ButtonDown && "IsDoubleClick only valid for ButtonUp event");

    return DoubleClick;
}

int64_t SMouseButtonEvent::GetWheeledDistance() const
{
    assert(Type==EMouseEventType::WheelRoll && "GetWheeledDistance only valid for WheelRoll event");
    return WheelDistance;
}

SIntPoint SMouseButtonEvent::GetMoveDistance() const
{
    assert(Type==EMouseEventType::Move && "GetMoveDistance only valid for ButtonUp event");
    return MoveDistance;
}

bool SMouseButtonEvent::HaveFiles() const
{
    return !FilePaths.Empty();
}

TVector<SPath> SMouseButtonEvent::GetFilePaths() const
{
    return FilePaths;
}




uint64_t SMouseButtonEvent::GetWindowID() const
{
    return WindowID;
}

bool SMouseButtonEvent::IsButtonPressed(EMouseButton Button)
{
    switch(Button)
    {
        case EMouseButton::Left:
            return State.bIsLeftButtonPressed;
        case EMouseButton::Right:
            return State.bIsRightButtonPressed ;
        case EMouseButton::Middle:
            return State.bIsMiddleButtonPressed;

        default :
            return false;
    }
}


SIntPoint SMouseButtonEvent::GetMosuePositionOnScreen()
{
    return State.ScreenPosition;
}

SMouseState SMouseButtonEvent::State=SMouseState();
